import physgin.*;
import java.applet.Applet;
import javax.swing.*;
import java.awt.*;
import com.sun.j3d.utils.applet.JMainFrame;

public class Tower extends Applet
{
  J3dWorld w;
  BodyController b;
  
  public static void main(String[] args)
  {
    Tower program = new Tower();
    JMainFrame mf = new JMainFrame(program, 800, 600);
  }
  
  Tower()
  {
    setLayout(new BorderLayout());
    w = new J3dWorld();
      w.setBackground("background1.jpg");
    b = new BodyController(w);
    Component c = (Component) w.getCanvas();
    add(c);

    J3dBody x;
    //floor
    for (int i = 1; i < 8; i++)
    {
      x = new J3dBody("floor.jpg",Shapes.SQUARE, ((i*0.8f)-3.2f),-0.4f, 101f, 0.4f, 0f,0f, 0.0f, 0.0f);
      b.addBody(x);
    }
    
    //leftwall
    for (int i = 1; i < 8; i++)
    {
      x = new J3dBody("wall.jpg",Shapes.SQUARE, -2.6f,((i*0.8f)-0.4f), 101f,0.4f, 0f,0f, 0.0f, 0.0f);
      b.addBody(x);
    }

    
    //Tower
    for (int i = 1; i < 5; i++)
    {
      x = new J3dBody("floor.jpg",Shapes.SQUARE, 1.2f,((i*0.6f) - 0.3f), 3f,0.3f, 0f,0f, 0.0f, 0.0f);
      b.addBody(x);
    }
    
    // new J3dBody(Texture,Shape,Position X,Y,Mass,Size,Velocity X,Y, Orientation,Coefficient Restitution)
    J3dBody player = new J3dBody("circle.jpg",Shapes.CIRCLE, -2.0f,0.8f, 28f,0.4f, 4.5f,0.0f, 0f,.8f);
    b.addBody(player);
    b.start(); 
  }
}
